﻿using System;

namespace ExceptionHandling
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int x;
                
                try
                {
                    x = int.Parse(Console.ReadLine());
                    
                    if (x == 0)
                    {
                        //ThrowException();
                        break;
                    }
                }
                catch (ArgumentNullException e)
                {
                    PrintException(e);
                }
                catch (FormatException e)
                {
                    PrintException(e);
                }
                catch (OverflowException e)
                {
                    PrintException(e);
                }
                catch (Exception e)
                {
                    PrintException(e);
                }
                finally
                {
                    Console.WriteLine("-----------------");
                }
            }
            
        }

        private static void ThrowException()
        {
            throw new NotImplementedException();
        }

        static void PrintException(Exception e)
        {
            Console.WriteLine("Exception Type: {0}{1}Exception Message: {2}",
                        e.GetType().Name, Environment.NewLine, e.Message);
            
        }
    }
}
